var eeui = app.requireModule('eeui');
const umengPush = app.requireModule("eeui/umengPush");
const storage = weex.requireModule("storage");
Vue.mixin({
	data() {
		return {
			globalData: {
				Color: '#3EB4FF',
				APP_BASE_API : 'http://dev.qmin365.cn:8080',
				mchId: '10200',
				mchName: '测试机',
				uuid: null,
				userInfo: null,
				token: null,
				shopId: null,
				shopName: '测试机',
			},
			vipPriceName:'批发价',
			welfareShow:true,
			eliteCouponsShow:false,
			APP_TYPE: 0,
			VERSION:4,
			location: false,
			companyName: '测试机',
			shareData:{
				title:'测试机',
				url:'http://dev.qmin365.cn',
				thumb:'http://cdn.rzico.com/qm365/ic_launcher.png',
				description:'欢迎注册并使用测试机'
			}
		}

	},

	created() {
		var _this = this
		let data = eeui.getCachesString("globalData");
		if (!this.isEmptyString(data)) {
		    let globalData  = JSON.parse(data);
		    if (!this.isEmptyString(globalData.APP_BASE_API)) {
		        this.globalData = globalData;
		    }
		}
		if (this.globalData.uuid == null) {
		    _this.globalData.uuid =  this.getImei();
		}
		let dataStr = JSON.stringify(this.globalData);
		console.log(dataStr)
		eeui.setCachesString("globalData",dataStr);
	},
	methods: {
		getGlobalData() {
			         let data = eeui.getCachesString("globalData");
			         if (!this.isEmptyString(data)) {
			             let globalData = JSON.parse(data);
			             if (!this.isEmptyString(globalData.APP_BASE_API)) {
			                 this.globalData = globalData;
			             }
			         }
			         return this.globalData;
		},
		setGlobalData(data) {
			this.globalData = data;
			//上线的加这行测试加这行
			let dataStr = JSON.stringify(this.globalData);
			eeui.setCachesString("globalData", dataStr)
		}
	}
});
